<!--
 * @FilePath     : /study_code/layui/17-22.html
 * @Description  : ready 回调配置项：控件初始打开的回调
 * @Date         : 2025-04-10 11:19:19
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-10 11:19:37
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <div class="layui-inline">
      <!-- 注意：外面这层元素并不是必须的 -->
      <input type="text" placeholder="请选择开始日期" class="layui-input" id="test1" />
    </div>

    <script src="/layui/dist/layui.js"></script>
    <script>
      layui.use('laydate', function () {
        var laydate = layui.laydate

        //执行一个laydate实例
        laydate.render({
          elem: '#test1', //指定元素

          /**
           * @brief: 控件初始打开的回调
           * @param {Object} date 初始的日期时间对象
           * @return {*}
           */
          ready: function (date) {
            console.log(date) // 得到初始的日期时间对象 （min参数的设置）：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
          },
        })
      })
    </script>
  </body>
</html>
